package com.apeli;

import com.apeli.design.MessagePublisher;
import com.apeli.model.User;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.util.ClassUtils;

import javax.swing.*;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

@ComponentScan
public class SourceApplication {
    public static void main(String[] args) throws ClassNotFoundException {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SourceApplication.class);
//        MessagePublisher messagePublisher = (MessagePublisher) context.getBean("messagePublisher");
//
//        messagePublisher.publishEvent(new MessagePublisher.Event(10,"消息"));
//        System.out.println("contine...");
//        System.out.println(ClassUtils.getDefaultClassLoader());
//        Class<?> aClass = ClassUtils.forName("com.apeli.model.User", ClassUtils.getDefaultClassLoader());
//        System.out.println(aClass);
//        System.out.println(context.getBean("userService"));
        User user = context.getBean("user",User.class);
        System.out.println(user);
    }

}
